package com.tang.commodity.controller;

import com.tang.commodity.entity.User;
import com.tang.commodity.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/*
 *文件名: UserContoller
 *创建者: 醉意丶千层梦
 *创建时间:2021/12/13 13:16
 *描述: 这是一个示例
 */
@RestController
public class UserController {
    @Autowired
    private UserService userService;


    @ResponseBody
    @RequestMapping(value = "/user",method = RequestMethod.GET)
    public List<User> getAccount(){
        return userService.getAllUsers();
    }


    @ResponseBody
    @RequestMapping(value = "/user/find",method = RequestMethod.POST)
    public User findUser(User user){
        System.out.println(user);
        return userService.findUser(user);
    }
}
